const express = require('express'); // 导入express
const router = express.Router(); // 创建路由对象
const userHandler = require('../router_handler/user'); // 导入路由处理函数模块

// 1. 导入验证表单数据的中间件
const expressJoi = require('@escook/express-joi')
// 2. 导入需要的验证规则对象
const { reg_login_schema } = require('../schema/user')

router.post('/reg', expressJoi(reg_login_schema), userHandler.reg);
router.post('/login', expressJoi(reg_login_schema), userHandler.login);

module.exports = router; // 向外暴露路由对象